<?php 

ob_start() ;
require_once('../../../../include/inc_config.php') ;

if ((isset($_GET['Identifiant_rib'])) && ($_GET['Identifiant_rib'] != "")) 
{

  /*$deleteSQL = sprintf("DELETE FROM rib WHERE Identifiant_personne=%s and Identifiant_rib=%s",
                       GetSQLValueString($_GET['Identifiant_personne'], "int"),
					   GetSQLValueString($_GET['Identifiant_rib'], "int"));*/
    
  // --- ne pas supprimer le rib de la table
  // --- juste le mettre en inactif
  $deleteSQL  = " UPDATE rib SET Etat_rib = '" . ETAT_RIB_INACTIF . "' " ;
  $deleteSQL .= " WHERE Identifiant_rib = " . GetSQLValueString($_GET['Identifiant_rib'], "int") ;
  $deleteSQL .= " AND Identifiant_personne = " . GetSQLValueString($_GET['Identifiant_personne'], "int") ;

  mysql_select_db($database_microassur, $microassur);
  mysql_query("START TRANSACTION");
  $Result1 = mysql_query($deleteSQL, $microassur) or die(mysql_error());
  
  $zUrlReturn  = 'index.php?Identifiant_personne=' . $_GET['Identifiant_personne'] ;
  $zUrlReturn .= '&Identifiant_contrat=' . $_GET['Identifiant_contrat'] ;
  
  if($Result1)
  { 
    $zUrlReturn .= '&supp=success' ;
  	mysql_query("commit") ;
  	header("Location: " . $zUrlReturn ) ;
  }
  else 
  {
  	$zUrlReturn .= '&supp=err' ;
  	mysql_query("rollback");
  	header("Location: " . $zUrlReturn);
  }
}

?>
<?php ob_end_flush();?>
